﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hrm.Core
{
    public partial interface IRepository<T> where T : Entity
    {
        IList<T> ExecuteStoredProcedureList(string commandText, params object[] parameters);

        IEnumerable<T> SqlQuery(string sql, params object[] parameters);

        int ExecuteSqlCommand(string sql, bool doNotEnsureTransaction = false, int? timeout = null, params object[] parameters);

        T GetById(object id);

        T Get(Func<T, bool> predicate);

        IEnumerable<T> GetAll();

        IEnumerable<T> GetList(Func<T, bool> predicate);

        int Insert(T entity, bool isSave = true);

        void Insert(IEnumerable<T> entities, bool isSave = true);

        int Update(T entity, bool isSave = true);

        void Update(IEnumerable<T> entities, bool isSave = true);

        int Delete(T entity, bool isSave = true);

        int Delete(int id, bool isSave = true);

        void Delete(IEnumerable<T> entities, bool isSave = true);

        IQueryable<T> Table { get; }

        IQueryable<T> TableNoTracking { get; }

        int Commit();
    }
}
